* Org-mode test

#+begin_src elisp
  (require 'org-tempo)
  (require 'ob-erlang)
  (org-babel-do-load-languages
   'org-babel-load-languages
   '((erlang . t)
     (shell . t)))
#+end_src

#+RESULTS:

#+BEGIN_SRC erlang :module tryerlang
start() ->
	io:format("hello world").
#+END_SRC

* Start REPL

#+BEGIN_SRC shell :results output
erl
#+END_SRC

#+RESULTS:
: Eshell V10.3.5.9  (abort with ^G)
: 1> *** Terminating erlang (nonode@nohost)

* Language elements

** Arithmetic

#+BEGIN_SRC erlang :results value
3+4.
#+END_SRC

*** Operations

- +,-,*,/
- div (division without remainder)
- rem (remainder of whole number division)
-

#+RESULTS:

** Lists

#+BEGIN_SRC erlang
A = [2,3,4].
hd(A).
#+END_SRC

** Lambda expressions

#+BEGIN_SRC erlang
(fun (X) -> X+X end)(99).
#+END_SRC

** Primitive data types

1. Numbers
   1. Integer - Bignums, arbitrarily large and full precision
      1. Numbers with different base: ~2#10010011~ for example is binary.
2. Atoms
   1. written with small letter in the first place: ~foo~
   2. written in single quotes: ~'i am an atom'~
   3. compare: ~==~
   4. order: ~>, <~
   5. special atoms: ~true, false~
3. Booleans:
   1. ~true~
   2. ~false~
4. Tuples:
   1. pieces of data, put together in curly braces: ~{1,2,3,{4,5}}~
   2. often data is tagged tuples: ~{<atom describing the tuple>, <payload>}~ for example: ~{rectangle, {0, 0}, {2, 3}}~
   3. data can be heterogenous
   4. immutable, must be built in one go
5. Lists:
   1. in square brackets: ~[elem1, elems]~
   2. data can be heterogenous, often is homogenous
   3. append operation: ~++~
   4. length: ~length/1~
6. Strings:
   1. list of characters
   2. characters are numbers
   3. ASCII code for a character: ~$<char>~
7. Functions:
   1. anonymous function syntax: ~fun (<args> ...) -> <exprs> ... end~
